using UnityEngine;
using QFramework;

namespace dilao
{
	public partial class Enemy : ViewController
	{
        public int Hp = 3;
        [SerializeField]
        private float speed;
     
        private void Update()
        {
          if(Player.GetInstance())
            {
                var direction = (Player.GetInstance().transform.position - transform.position).normalized;
                transform.Translate(direction * speed * Time.deltaTime);
            }
          if(Hp<=0)
            {
                GameRoot.GetInstance().grade.Value++;
                this.DestroyGameObjGracefully();
            }
        }
    }
}
